//
//  OILineTextField.m
//  EducationOID
//
//  Created by slz on 2017/5/12.
//  Copyright © 2017年 bnsr. All rights reserved.
//

#import "OILineTextField.h"

@implementation OILineTextField

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)awakeFromNib
{
    [super awakeFromNib];
    [self addBottomLineLayer];
}

- (instancetype)init{
    self = [super init];
    if (self){
        [self addBottomLineLayer];
    }
    return self;
}

-(void)setBottonLineColor:(UIColor *)bottonLineColor
{
    [self setNeedsDisplay];
}

- (void)addBottomLineLayer{
    _bottomLineLayer = [CALayer new];
    [self.layer addSublayer:_bottomLineLayer];
}

-(void)drawRect:(CGRect)rect{
    if (_bottomLineColor == nil){
        _bottomLineColor = [UIColor whiteColor];
        _bottomLineLayer.backgroundColor = _bottomLineColor.CGColor;
    }
    _bottomLineLayer.size = CGSizeMake(rect.size.width, 0.5);
    _bottomLineLayer.left = 0;
    _bottomLineLayer.bottom = rect.size.height - 0.5;
    _bottomLineLayer.backgroundColor = _bottomLineColor.CGColor;
}

@end
